/**
 * Created by Administrator on 2017/3/2 0002.
 */
var Game={
    create:function () {
        var game={};
        game.ui=new PIXI.DisplayObjectContainer();
        game.page0=Page0.create();
        game.ui.addChild(game.page0.ui);

        var subPage=new PIXI.Sprite();
        subPage.anchor.set(0.5);
        subPage.x=1136/2;
        subPage.y=540/2;
        subPage.interactive=true;
        subPage.on('pointertap',closeHandler);

        document.addEventListener('Game_SubIn',subInHandler);

        function subInHandler(e)
        {
            console.log('assets/images/image'+ e.detail+'.png');
            subPage.texture=resource['assets/images/image'+ e.detail+'.png'].texture;
            game.page0.bool_touch=false;
            subPage.scale.x=subPage.scale.y=0;
            TweenMax.to(subPage.scale,0.5,{x:1,y:1,ease:Cubic.easeOut,onComplete:function(){
                subPage.interactive=true;
            }});
            game.ui.addChild(subPage);
            changeMusic('1');
        }
        function closeHandler(e)
        {
            changeMusic('0');
            e.data.originalEvent.stopImmediatePropagation();
            e.data.originalEvent.preventDefault();
            subPage.parent.removeChild(subPage);
            subPage.interactive=false;
            setTimeout(function () {
                game.page0.bool_touch=true;
            },300)

        }
        // con.interactive=true;
        // for(var i=0;i<5;i++)
        // {
        //     var page=Page1.create();
        //     con.addChild(page.ui);
        //     page.ui.y=i*pixiStageH;
        // }
        // Scroller.create(con,pixiStageW,pixiStageH,'ver',4);
        //
        // game.ui=con;

        
        return game;
    }

}